package com.example.lib_core.mvp.view;

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.blankj.utilcode.util.ToastUtils;
import com.example.lib_core.R;
import com.example.lib_core.mvp.presenter.IPresenter;

import javax.inject.Inject;

public abstract class BaseFragment<P extends IPresenter> extends Fragment implements IView,IFragment {

    @Inject
    protected P mPresenter;
    private View view;
    private Dialog dialog;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         view = inflater.inflate(bondLayout(), container, false);
         Inject();
         initView();
         initData();
        return view;
    }
    @Override
    public void showDialog() {
//        dialog=new Dialog(getContext(), R.style.FullScreenDialog);
//        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.pop, null);
//        dialog.setContentView(inflate);
//        dialog.show();
    }

    public Object findviewByIds(int i){
        return view.findViewById(i);
    }
    @Override
    public void hideDialog() {

//        dialog.dismiss();
    }

    @Override
    public void showToast(String msg) {
        ToastUtils.showShort(msg);
    }
}
